/**
 * 
 */
package playGround.dungeon;


import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

/**
 * @author Niels Claeys, Maarten Christiaen
 *
 */
public class PositionTest {
	
	private Position position;
	private Position position1;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		position = new Position(1,1,1);
		position1 = new Position(2,1,1);
	}
	@Test
	public void getDirectionOfEastTest(){
		assertEquals(Direction.EAST,position.getDirectionOf(position1));
	}
	@Test
	public void getDirectionOfCeilingTest(){
		assertEquals(Direction.CEILING,position.getDirectionOf(new Position(1,1,2)));
	}
	@Test
	public void getDirectionOfNorthTest(){
		assertEquals(Direction.SOUTH,position.getDirectionOf(new Position(1,2,1)));
	}
	@Test
	public void getDirectionOfFailTest(){
		assertEquals(null,position.getDirectionOf(new Position(2,2,1)));
	}
	@Test
	public void equalsTest(){
		Position pos1=new Position(2,3,4);
		Position pos2=new Position(2,3,4);
		assertTrue(pos1.equals(pos2));
		assertFalse(pos1.equals(position));
	}
	public void equals2FalseTest(){
		Position pos1=new Position(2,1,3);
		Position pos2=new Position(2,1,2);
		Position pos3=new Position(2,1,4);
		assertFalse(pos3.equals(pos2));
		assertFalse(pos2.equals(pos1));
		assertFalse(pos1.equals(position));
	}
	@Test
	public void equalsTestWithLargeNumbers(){
		Position pos1=new Position(Integer.MAX_VALUE+100,3,2);
		Position pos2=new Position(Integer.MAX_VALUE+100,3,2);
		Position pos3=new Position(Integer.MAX_VALUE+102,3,2);
		assertTrue(pos1.equals(pos2));
		assertFalse(pos1.equals(pos3));
	}
	@Test
	public void hashCodeTest(){
		Position pos1=new Position(Integer.MAX_VALUE+100,3,2);
		Position pos3=new Position(Integer.MAX_VALUE+102,3,2);
		assertFalse(pos1.hashCode()==pos3.hashCode());
	}
	@Test
	public void toStringTest(){
		Position pos= new Position(1,2,3);
		assertEquals("("+1+","+2+","+3+")",pos.toString());
	}

}
